﻿//https://leetcode.cn/problems/container-with-most-water/?envType=study-plan-v2&envId=top-100-liked

class Solution {
public:
    int maxArea(vector<int>& height)
    {
        int left = 0, right = height.size() - 1;
        int ret = 0;
        while (left < right)
        {
            ret = max(ret, min(height[left], height[right]) * (right - left));
            if (height[right] > height[left])
                left++;
            else
                right--;
        }
        return ret;
    }
};